package com.guqj.thread.design;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class ThreadTest {

	public static void main(String[] args) {
		MyBlockQueue<String> queue = new MyBlockQueue<String>(10);
		ProducerThread producer = new ProducerThread(queue);
		ConsumerThread consumer = new ConsumerThread(queue);
		Thread p = new Thread(producer, "生产者");
		Thread c = new Thread(consumer, "消费者");
		p.start();
		c.start();
		p.interrupt();
		//new Thread(producer, "生产者").start();
		//new Thread(consumer, "消费者").start();
	}
	
	public static void arrayCopy(){
		Map<String, Object> map = Collections.synchronizedMap(new HashMap<String, Object>());
		System.out.println(map.getClass());
		int[] a = Arrays.copyOf(new int[]{1,2,3}, 20);
		System.out.println(a[19]);
	}
}
